<?php
     @session_start();
    include("template/head.php");
  //  include("template/menu_left.php");   
    require_once ("submit/fournisseurs/get_list_fournisseur.php");  
	if($user['account_login']=="user"){
		header('location:list_article.php?action=access_denied');
	}
?>
    <div class="container-fluid">
        <div class="row-fluid">
                
        <?php include("template/menu_left.php") ?>                

        <div class="span10" id="content">
            <?php
                if ((isset($_GET["action"])) && ($_GET["action"] == "deleted"))
                {
                echo'
                <div class="alert alert-success col-lg-7" style="margin:10px;">
                    Fournisseur supprimé avec succès <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
                if ((isset($_GET["action"])) && ($_GET["action"] == "added"))
                {
                echo'
                <div class="alert alert-success col-lg-7" style="margin:10px;">
                    Le Fournisseur: <b>'.$_GET['name'].'</b> ajouté avec succès <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
                if ((isset($_GET["action"])) && ($_GET["action"] == "updated"))
                {
                echo'
                <div class="alert alert-success col-lg-7" style="margin:10px;">
                    Mise à jour du fournisseur '.$_GET["name"].' effectuée avec succès. <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }
                if ((isset($_GET["action"])) && ($_GET["action"] == "addedError"))
                {
                echo'
                <div class="alert alert-danger col-lg-7" style="margin:10px;">
                    Le Fournisseur existe déjà. <button type="button" class="close" data-dismiss="alert">&times;</button>
                </div>
                ';
                }

            ?>  
            <div class="row-fluid">
            <!-- block -->
            <div class="block">
              <div class="navbar navbar-inner block-header">
                <div class="muted pull-left">Liste des fournisseurs (<?php  $num = mysql_num_rows($result_list_fournisseur); echo $num ; ?>)</div>
              	<div class="pull-right"><a class="btn btn-primary btn-sm" href="add_fournisseur.php" style="float:right;width:200px;margin-bottom:20px;" >Nouveau Fournisseur</a></div>
              </div>
              <div class="block-content collapse in">
                <div class="span12">
                    <table cellpadding="0" cellspacing="0" border="0" class="table table-striped table-bordered" id="example">
                    <thead>
                      <tr>
                        <th>Raison sociale</th>
                        <th>Nom</th>
                        <th>Prénom</th>
                        <th>Pays</th>
                        <th>E-mail</th>
                        <th></th>
                      </tr>
                    </thead>
                    <tbody>
                       <?php    
                         while($row = mysql_fetch_object($result_list_fournisseur))
                        {
                        ?>
        
                      <tr class="odd gradeX">
                        <td><?php echo $row->raison_social?></td>
                        <td><?php echo $row->nom_fournisseur?></td>
                        <td><?php echo $row->prenom_fournisseur?></td>
                        <td><?php echo $row->pays?></td>
                      	<td><?php echo $row->email_fournisseur?></td>
                        <td>
                            <a href="#<?php echo $row->id_fournisseur?>myModal" data-toggle="modal"  class="btn btn-small" style="margin-right:20px;">Détails</a>      
                            <div id="<?php echo $row->id_fournisseur?>myModal" class="modal hide">
                                <div class="modal-header">
                                    <button data-dismiss="modal" class="close" type="button">&times;</button>
                                     
                                        <p><strong>Numéro Tél : </strong><?php echo $row->tel_fournisseur?></p>
                                        <p><strong>Numéro Fax : </strong><?php echo $row->fax_fournisseur?></p>	<br>
                                        
                                        <p><strong>Description : </strong><?php echo nl2br($row->description)?></p>	
                                    </div>
                                
                                    <div class="modal-footer">
                                        <a data-dismiss="modal" class="btn btn-inverse" href="#">Fermer</a>
                                    </div>
                            </div>
                            
                            <a class="btn btn-primary btn-small" href="edit_fournisseur.php?action=update&id_fournisseur=<?php echo $row->id_fournisseur?>"><i class="icon-pencil icon-white"></i></a>
                            
                            <a href="#myModal<?php echo $row->id_fournisseur?>" data-toggle="modal"  class="btn btn-danger btn-small"><i class="icon-remove icon-white"></i> </a>  
                            
                            <div id="myModal<?php echo $row->id_fournisseur?>" class="modal hide">
                                <div class="modal-header">
                                    <button data-dismiss="modal" class="close" type="button">&times;</button>
                                        <p>Voulez-vous supprimer : <strong> <?php echo $row->raison_social ?></strong> </p>
                                    </div>
                                
                                    <div class="modal-footer">
                                        <a class="btn btn-primary" href="submit/fou
                                        rnisseurs/edit_delete_fournisseur.php?action=delete&id_fournisseur=<?php echo $row->id_fournisseur?>">Confirmer</a>
                                        <a data-dismiss="modal" class="btn" href="#">Annuler</a>
                                    </div>
                            </div>
                        </td>
                      </tr>
                      <?php
                        }
                      ?>
                    </tbody>
                  </table>
                </div>
                <a class="btn btn-primary btn-sm" href="add_fournisseur.php" style="float:right;width:200px;margin:20px;" >Nouveau Fournisseur</a>
              </div>
            </div>
        <!-- /block -->
          </div>
                </div>
            </div>
            <hr>
        </div>
<?php  include("template/footer.php") ; ?>